﻿namespace VisualSVN.Core.Licensing
{
    using System;
    using VisualSVN.Core;

    public class DecoderSequence : IDecoder
    {
        private IDecoder[] decoders;

        public DecoderSequence(params IDecoder[] decoders)
        {
            this.decoders = decoders;
        }

        public byte[] Decode(byte[] data)
        {
            byte[] buffer = data;
            for (int i = this.decoders.Length - 1; i >= 0; i--)
            {
                buffer = this.decoders[i].Decode(buffer);
            }
            return buffer;
        }
    }
}

